package Class20240812;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;

public class class20240826 {

    public static void main(String[] args) {
        //加载JDBC驱动
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            //建立连接
            String url = "jdbc:mysql://127.0.0.1:3306/a65?serverTimezone=UTC";
            String username = "root";
            String password = "415253";
            Connection connection = DriverManager.getConnection(url, username, password);
            //  System.out.println(connection);
            //创建Statement
            Statement statement = connection.createStatement();
            //执行SQL语句

            //String sql = "delete from emp where empno=9";
             String sql = "insert into emp (ename,hiredate,job,mgr,sal,comm,deptno) values('李白','2024-08-19','讲师',1,2,3,4)";

            // String sql = "select * from emp";
            statement.executeUpdate(sql);
            statement.close();
            connection.close();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {

        }
    }
}
